<!-- polls/templates/polls/index.html -->
{% extends "polls/base.html" %}

{% block title %}最新投票{% endblock %}

{% block content %}
<div class="text-center mb-5">
    <h1 class="display-4 fw-bold text-primary mb-3">最新投票议题</h1>
    <p class="lead text-muted">选择您感兴趣的议题参与投票</p>
</div>

{% if latest_question_list %}
<div class="row row-cols-1 row-cols-md-2 g-4">
    {% for question in latest_question_list %}
    <div class="col">
        <div class="question-card card h-100 shadow-sm">
            <div class="card-body">
                <h5 class="card-title fw-bold">{{ question.question_text }}</h5>
                <p class="text-muted small">
                    发布时间：{{ question.pub_date|date:"Y-m-d H:i" }}
                </p>
                <a href="{% url 'polls:detail' question.id %}" 
                   class="btn btn-primary stretched-link">
                    立即投票 →
                </a>
            </div>
        </div>
    </div>
    {% endfor %}
</div>
{% else %}
<div class="text-center py-5">
    <img src="https://img.icons8.com/clouds/200/000000/nothing-found.png" 
         alt="No polls" 
         class="mb-4">
    <h3 class="text-muted">暂时没有可用的投票</h3>
</div>
{% endif %}
{% endblock %}
